package com.huifer.wgx.model;

import java.math.BigDecimal;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * <p>Title : FieldLineEntity </p>
 * <p>Description : </p>
 *
 * @author huifer
 * @date 2019-03-20
 */
@Entity
@Table(name = "t_field_line", schema = "at15", catalog = "")
public class FieldLineEntity {

    private Long fieldLineId;
    private String fieldLineStartPointName;
    private Long fieldLineStartPointId;
    private BigDecimal fieldLineStartDeep;
    private String fieldLineEndPointName;
    private Long fieldLineEndPointId;
    private BigDecimal fieldLineEndDeep;
    private String fieldLineDs;
    private String fieldLineMaterial;
    private Long workId;
    private Long personnelId;
    private Long fileId;
    private FieldPointEntity tFieldPointByFieldLineStartPointId;
    private FieldPointEntity tFieldPointByFieldLineEndPointId;
    private WorkEntity tWorkByWorkId;
    private PersonnelEntity tPersonnelByPersonnelId;
    private FileEntity tFileByFileId;

    @Id
    @Column(name = "field_line_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getFieldLineId() {
        return fieldLineId;
    }

    public void setFieldLineId(Long fieldLineId) {
        this.fieldLineId = fieldLineId;
    }

    @Basic
    @Column(name = "field_line_start_point_name")
    public String getFieldLineStartPointName() {
        return fieldLineStartPointName;
    }

    public void setFieldLineStartPointName(String fieldLineStartPointName) {
        this.fieldLineStartPointName = fieldLineStartPointName;
    }

    @Basic
    @Column(name = "field_line_start_point_id")
    public Long getFieldLineStartPointId() {
        return fieldLineStartPointId;
    }

    public void setFieldLineStartPointId(Long fieldLineStartPointId) {
        this.fieldLineStartPointId = fieldLineStartPointId;
    }

    @Basic
    @Column(name = "field_line_start_deep")
    public BigDecimal getFieldLineStartDeep() {
        return fieldLineStartDeep;
    }

    public void setFieldLineStartDeep(BigDecimal fieldLineStartDeep) {
        this.fieldLineStartDeep = fieldLineStartDeep;
    }

    @Basic
    @Column(name = "field_line_end_point_name")
    public String getFieldLineEndPointName() {
        return fieldLineEndPointName;
    }

    public void setFieldLineEndPointName(String fieldLineEndPointName) {
        this.fieldLineEndPointName = fieldLineEndPointName;
    }

    @Basic
    @Column(name = "field_line_end_point_id")
    public Long getFieldLineEndPointId() {
        return fieldLineEndPointId;
    }

    public void setFieldLineEndPointId(Long fieldLineEndPointId) {
        this.fieldLineEndPointId = fieldLineEndPointId;
    }

    @Basic
    @Column(name = "field_line_end_deep")
    public BigDecimal getFieldLineEndDeep() {
        return fieldLineEndDeep;
    }

    public void setFieldLineEndDeep(BigDecimal fieldLineEndDeep) {
        this.fieldLineEndDeep = fieldLineEndDeep;
    }

    @Basic
    @Column(name = "field_line_ds")
    public String getFieldLineDs() {
        return fieldLineDs;
    }

    public void setFieldLineDs(String fieldLineDs) {
        this.fieldLineDs = fieldLineDs;
    }

    @Basic
    @Column(name = "field_line_material")
    public String getFieldLineMaterial() {
        return fieldLineMaterial;
    }

    public void setFieldLineMaterial(String fieldLineMaterial) {
        this.fieldLineMaterial = fieldLineMaterial;
    }

    @Basic
    @Column(name = "work_id")
    public Long getWorkId() {
        return workId;
    }

    public void setWorkId(Long workId) {
        this.workId = workId;
    }

    @Basic
    @Column(name = "personnel_id")
    public Long getPersonnelId() {
        return personnelId;
    }

    public void setPersonnelId(Long personnelId) {
        this.personnelId = personnelId;
    }

    @Basic
    @Column(name = "file_id")
    public Long getFileId() {
        return fileId;
    }

    public void setFileId(Long fileId) {
        this.fileId = fileId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        FieldLineEntity that = (FieldLineEntity) o;
        return Objects.equals(fieldLineId, that.fieldLineId) &&
                Objects.equals(fieldLineStartPointName, that.fieldLineStartPointName) &&
                Objects.equals(fieldLineStartPointId, that.fieldLineStartPointId) &&
                Objects.equals(fieldLineStartDeep, that.fieldLineStartDeep) &&
                Objects.equals(fieldLineEndPointName, that.fieldLineEndPointName) &&
                Objects.equals(fieldLineEndPointId, that.fieldLineEndPointId) &&
                Objects.equals(fieldLineEndDeep, that.fieldLineEndDeep) &&
                Objects.equals(fieldLineDs, that.fieldLineDs) &&
                Objects.equals(fieldLineMaterial, that.fieldLineMaterial) &&
                Objects.equals(workId, that.workId) &&
                Objects.equals(personnelId, that.personnelId) &&
                Objects.equals(fileId, that.fileId);
    }

    @Override
    public int hashCode() {
        return Objects
                .hash(fieldLineId, fieldLineStartPointName, fieldLineStartPointId,
                        fieldLineStartDeep,
                        fieldLineEndPointName, fieldLineEndPointId, fieldLineEndDeep, fieldLineDs,
                        fieldLineMaterial, workId, personnelId, fileId);
    }

    @ManyToOne
    @JoinColumn(name = "field_line_start_point_id", referencedColumnName = "field_point_id",insertable = false,updatable = false)
    public FieldPointEntity gettFieldPointByFieldLineStartPointId() {
        return tFieldPointByFieldLineStartPointId;
    }

    public void settFieldPointByFieldLineStartPointId(
            FieldPointEntity tFieldPointByFieldLineStartPointId) {
        this.tFieldPointByFieldLineStartPointId = tFieldPointByFieldLineStartPointId;
    }

    @ManyToOne
    @JoinColumn(name = "field_line_end_point_id", referencedColumnName = "field_point_id",insertable = false,updatable = false)
    public FieldPointEntity gettFieldPointByFieldLineEndPointId() {
        return tFieldPointByFieldLineEndPointId;
    }

    public void settFieldPointByFieldLineEndPointId(
            FieldPointEntity tFieldPointByFieldLineEndPointId) {
        this.tFieldPointByFieldLineEndPointId = tFieldPointByFieldLineEndPointId;
    }

    @ManyToOne
    @JoinColumn(name = "work_id", referencedColumnName = "work_id",insertable = false,updatable = false)
    public WorkEntity gettWorkByWorkId() {
        return tWorkByWorkId;
    }

    public void settWorkByWorkId(WorkEntity tWorkByWorkId) {
        this.tWorkByWorkId = tWorkByWorkId;
    }

    @ManyToOne
    @JoinColumn(name = "personnel_id", referencedColumnName = "personnel_id",insertable = false,updatable = false)
    public PersonnelEntity gettPersonnelByPersonnelId() {
        return tPersonnelByPersonnelId;
    }

    public void settPersonnelByPersonnelId(PersonnelEntity tPersonnelByPersonnelId) {
        this.tPersonnelByPersonnelId = tPersonnelByPersonnelId;
    }

    @ManyToOne
    @JoinColumn(name = "file_id", referencedColumnName = "file_id",insertable = false,updatable = false)
    public FileEntity gettFileByFileId() {
        return tFileByFileId;
    }

    public void settFileByFileId(FileEntity tFileByFileId) {
        this.tFileByFileId = tFileByFileId;
    }
}
